package org.jeecg.modules.dashboard.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.dashboard.service.IDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Description: 仪表盘统计
 * @Author: jeecg-boot
 * @Date: 2025-09-15
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "仪表盘统计")
@RestController
@RequestMapping("/dashboard/order")
public class DashboardController {

    @Autowired
    private IDashboardService dashboardService;

    /**
     * 获取月度订单统计数据
     *
     * @return
     */
    @AutoLog(value = "仪表盘-月度订单统计")
    @ApiOperation(value = "仪表盘-月度订单统计", notes = "仪表盘-月度订单统计")
    @GetMapping(value = "/monthlyAmount")
    public Result<Map<String, Object>> monthlyAmount() {
        Map<String, Object> result = dashboardService.getMonthlyOrderStatistics();
        return Result.OK(result);
    }
    
    /**
     * 获取用户统计数据
     *
     * @return
     */
    @AutoLog(value = "仪表盘-用户统计")
    @ApiOperation(value = "仪表盘-用户统计", notes = "仪表盘-用户统计")
    @GetMapping(value = "/stats")
    public Result<Map<String, Object>> stats() {
        Map<String, Object> result = dashboardService.getUserStatistics();
        return Result.OK(result);
    }
}